package com.company.nuwa.common.utils;

import java.math.BigDecimal;
import java.util.Objects;

/**
 * <p>数字工具类</p >
 *
 * @author youyoukele
 * @version 1.0
 * @date 2023/1/15 下午5:01
 */
public class NumberUtils {

    private static final Long EMPTY_NUMBER_L = 0L;
    private static final Integer EMPTY_NUMBER_I = 0;

    /**
     * 判断数字不为空
     *
     * @param number
     * @return
     */
    public static boolean isNotEmpty(Long number) {
        return Objects.nonNull(number) && !Objects.equals(EMPTY_NUMBER_L, number);
    }

    /**
     * 判断数字不为空
     *
     * @param number
     * @return
     */
    public static boolean isNotEmpty(Integer number) {
        return Objects.nonNull(number) && !Objects.equals(EMPTY_NUMBER_I, number);
    }

    /**
     * 判断数字不为空
     *
     * @param number
     * @return
     */
    public static boolean isNotEmpty(BigDecimal number) {
        return Objects.nonNull(number) && BigDecimal.ZERO.compareTo(number) != 0;
    }

    /**
     * 判断数字为空
     *
     * @param number
     * @return
     */
    public static boolean isEmpty(Long number) {
        return !isNotEmpty(number);
    }

    /**
     * 判断数字为空
     *
     * @param number
     * @return
     */
    public static boolean isEmpty(Integer number) {
        return !isNotEmpty(number);
    }

    /**
     * 判断数字为空
     *
     * @param number
     * @return
     */
    public static boolean isEmpty(BigDecimal number) {
        return !isNotEmpty(number);
    }

}
